package br.org.groupware_workbench.collablet.news;

import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.ioc.RequestScoped;
import br.com.caelum.vraptor.view.Results;

@Resource
@RequestScoped
public class NewsConfigurationController {
    
    private Result result;

    public NewsConfigurationController(Result result) {
        this.result = result;
    }
    
    @Get
    @Path(value = "/groupware-workbench/{collabletInstance}/news/configure")
    public void listNewsConfigure(NewsMgrInstance collabletInstance ) {
        // Deve de acontecer alguma coisa em este método.
        result.include("newsMgr", collabletInstance);
    }

    @Get
    @Path(value = "/groupware-workbench/{collabletInstance}/news/copyNewsFromAUN")
    public void copyFromAUN(NewsMgrInstance collabletInstance ) {
        System.out.println("llego a esta funcion para copiar dados do banco aun");
        collabletInstance.copyFromAUN(collabletInstance.getId());
        result.use(Results.logic()).redirectTo(NewsMgrController.class).list(collabletInstance);
    }
}
